package com.scqkxx.gamebox.activity.register;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;

import com.scqkxx.gamebox.R;
import com.scqkxx.gamebox.databinding.ActivityRegisterNameBinding;
import com.scqkzqtz.base.base.BaseActivity;
import com.scqkzqtz.base.library.utils.PreferenceUtils;
import com.scqkzqtz.base.library.utils.ToastUtils;


/**
 * Created by zsx on 2018/8/14.
 */

public class RegisterNameActivity extends BaseActivity<ActivityRegisterNameBinding> {

    @Override
    public int setLayoutId() {
        return R.layout.activity_register_name;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void init() {
        binding.mTitleView.setOnTitleClickListener((int titleType) -> finish());

        binding.btNext.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String first_name = binding.etXs.getText().toString();
                String last_name = binding.etName.getText().toString();
                if(TextUtils.isEmpty(first_name) || TextUtils.isEmpty(last_name)){
                    ToastUtils.showShortToast(RegisterNameActivity.this,"名字或姓氏不能为空!");
                }else {
                    startActivity(new Intent(RegisterNameActivity.this,RegisterEmailActivity.class));
                    PreferenceUtils.commitString("first_name",first_name);
                    PreferenceUtils.commitString("last_name",last_name);
                }
            }
        });
    }
}
